/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface CoreZxda extends BasicModel<CoreZxda> {
  zxdaZxbm?: string; // 专项编码
  zxdaZxmc?: string; // 专项名称
  zxdaLxrq?: string; // 立项日期
  zxdaDykh?: string; // 对应客户
  zxdaSfjx?: string; // 是否结项
  zxdaJxrq?: string; // 结项日期
  createByName?: string; // 创建人
  updateByName?: string; // 修改人
}

export const coreZxdaList = (params?: CoreZxda | any) =>
  defHttp.get<CoreZxda>({ url: adminPath + '/cardd/zxda/coreZxda/list', params });

export const coreZxdaListData = (params?: CoreZxda | any) =>
  defHttp.post<Page<CoreZxda>>({ url: adminPath + '/cardd/zxda/coreZxda/listData', params });

export const coreZxdaForm = (params?: CoreZxda | any) =>
  defHttp.get<CoreZxda>({ url: adminPath + '/cardd/zxda/coreZxda/form', params });

export const coreZxdaSave = (params?: any, data?: CoreZxda | any) =>
  defHttp.postJson<CoreZxda>({ url: adminPath + '/cardd/zxda/coreZxda/save', params, data });

export const coreZxdaImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/cardd/zxda/coreZxda/importData',
      onUploadProgress,
    },
    params,
  );

export const coreZxdaDelete = (params?: CoreZxda | any) =>
  defHttp.get<CoreZxda>({ url: adminPath + '/cardd/zxda/coreZxda/delete', params });

export const coreZxdaEnd = (params?: CoreZxda | any) =>
  defHttp.get<CoreZxda>({ url: adminPath + '/cardd/zxda/coreZxda/end', params });
